package com.mudalov.rec.dao.model.study;

import com.mudalov.rec.dao.interfaces.IClonable;
import java.io.Serializable;

public class Subject implements Serializable, IClonable<Subject> {

	private static final long serialVersionUID = -7764701591167829256L;

	private Long id;
	
	private String text;
	
	public Subject() {}
	
	public Subject(String text) {
		this.text = text;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((text == null) ? 0 : text.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof Subject))
			return false;
		Subject other = (Subject) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (text == null) {
			if (other.text != null)
				return false;
		} else if (!text.equals(other.text))
			return false;
		return true;
	}

    public Subject getClone() {
        Subject clone = new Subject();
        clone.setId(this.getId());
        clone.setText(this.getText());
        return clone;
    }
	
	
}
